<?php
require_once ('initialize.php');
include_once(Utils::getPath(array('repositories', 'userRepository.php')));

$userRep = new UserRepository();
$user = $userRep->findByUserName($_GET['username']);

if($user != null)
{
	$_SESSION['authenticated'] = true;
	$_SESSION['authenticatedId'] = $user->getId();
	$_SESSION['authenticatedUserName'] = $_GET['username'];
}else{
	Utils::goToErrorPage();
}

header("Location: index.php");
exit();

?>